package com.zhiwang.xiaoqu.mvp.model

import com.zhiwang.xiaoqu.mvp.model.request.*
import com.zhiwang.xiaoqu.mvp.model.response.*
import com.zhiwang.xiaoqu.mvp.model.room.User
import io.reactivex.Observable
import okhttp3.ResponseBody
import retrofit2.http.*

interface RestApi {


    @HTTP(method = "GET")
    fun downloadFile(@Url url: String): Observable<ResponseBody>


    @POST("member/login")
    fun login(loginRequest: LoginRequest): Observable<ResponseWrapper<LoginResponse>>

    @HTTP(method = "GET", path = "api/app_vcode")
    fun getGraphCode(@Query("tu_token") randomStr: String, @Query("vcode_type") type: String): Observable<ResponseBody>

    @POST("api/voice")
    fun getSmsCode(@Body requestBody: SmsCodeRequest): Observable<ResponseWrapper<Void>>

    @POST("member/login")
    fun loginByPhone(@Body request: LoginRequest): Observable<ResponseWrapper<User>>

    @POST("ucenter/bind_alipay")
    fun bindAliAccount(@Body request: BindAliAccountRequest): Observable<ResponseWrapper<Void>>


    @POST("ucenter_cash/cash_out")
    fun getWithDrawList(@Query("cash_type") type: String): Observable<ResponseWrapper<List<WithDrawItem>>>

    @POST("download/app_android_version")
    fun checkUpdate(): Observable<ResponseWrapper<UpdateCheck>>

    /*获取首页数据*/
    @POST("xiaoqu/index")
    fun getIndexData():Observable<ResponseWrapper<IndexUserInfo>>

    @POST("ucenter/message")
    fun getMessageList(@Body pageRequest: PageRequest): Observable<ResponseWrapper<ListReponseWrapper<Message>>>

    @POST("ucenter_cash/cash_out")
    fun withDraw(@Body req: WithDrawRequest): Observable<ResponseWrapper<String>>

    @GET("ucenter_cash/lists")
    fun getWithDrawRecordList(@Query("page") page: Int): Observable<ResponseWrapper<WithDrawRecordBody>>

    @POST("invite/my_friends")
    fun getFriendHeaderInfo(): Observable<ResponseWrapper<FriendHeaderInfo>>

    @POST("invite/my_friends_list")
    fun getFriendList(@Body pageRequest: PageRequest): Observable<ResponseWrapper<ListReponseWrapper<FriendItem>>>

    @POST("ucenter/message_readed")
    fun setMessageRead(): Observable<ResponseWrapper<Void>>

    @POST("siteinfo/xiaoqu")
    fun getAppAbout(): Observable<ResponseWrapper<About>>

    @POST("siteinfo/kefu")
    fun getServiceInfo(): Observable<ResponseWrapper<QQServiceInfo>>

    @POST("ucenter/my_info")
    fun getUserInfo(): Observable<ResponseWrapper<MyUserInfo>>

    @POST("ucenter/goldz_list")
    fun getMoneyDetailList(@Body pageRequest: PageRequest): Observable<ResponseWrapper<MoneyDetailBody>>

    @GET("member/login_weixin")
    fun checkWxBind(@Query("code") code: String, @Query("deviceid") deviceId: String): Observable<ResponseWrapper<BindBody>>
}